package com.test;

import java.util.List;

import weka.core.Instances;

import com.iamk.util.GetData;
import com.iamk.util.GetInstances;
import com.jMEF.gmm.Image;

public class RunCross {
	public static void main(String[] args) {
		Instances tempTrain;
		int n = 3, m = 14;
		double[][] temp;
		double[] p = new double[10];
		List<Instances> lisTrain = GetInstances
				.getListInstance("PreData\\Train");
		List<Instances> lisTest = GetInstances.getListInstance("PreData\\Test");
		for (int i = 0; i < lisTrain.size(); i++) {
			tempTrain = lisTrain.get(i);
			for (int k = 0; k < m; k++) {
				temp = GetData.getSubMatrix(GetData.getData(tempTrain, (k + 1)), 9);
				System.out.println("Label " + (k + 1) + ": " + temp.length);
				Image._loadMixtureModel("GMM1/label" + (k + 1) + ".mix", temp,n, tempTrain.numInstances());
			}
			//
			TestGMM testGMM = new TestGMM();
			double r = testGMM.testGMM(GetData.getDataMatrix(lisTest.get(i)));
			p[i] = r;
		}
		for (int k = 0; k < p.length; k++) {
			System.out.println(p[k]);
		}
	}
}
